﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace Catalog.API.Model
{
    public class Product
    {
        public int Id { get;private set; }
        /// <summary>
        /// 产品代码
        /// </summary>
        public string ProductCode { get; private set; }
        /// <summary>
        /// 产品类别(0:快递；1:扔垃圾)
        /// </summary>
        public int ProductType { get; set; }
        /// <summary>
        /// 产品名称(快递，收垃圾)
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 尺寸(0:小 1：中 2：大)
        /// </summary>
        public int Size { get; private set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; private set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateUserId { get; private set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? ModifyTime { get;  set; }
        /// <summary>
        /// 修改人
        /// </summary>
        public DateTime? ModifyUserId { get;  set; }
        /// <summary>
        /// 产品价格
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal Price { get; set; }

        public Product(string name,int size,decimal price,string createUserId,string description,string remark)
        {
            this.ProductCode = Guid.NewGuid().ToString("N");
            this.Name = name;
            this.Size = size;
            this.CreateUserId = createUserId;
            this.Description = description;
            this.Remark = remark;
            this.CreateTime = DateTime.Now;
        }
    }
}
